<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Exercício 4</title>
<style>
form#formulario div {
	margin: 10px 0;
}

form#formulario div input[type=text] {
	margin: 0 10px;
}
form#formulario div span.confirmar{
	font-weight: bold;
	margin: 0 10px;
}
</style>
</head>
<body>
	<c:choose>
		<c:when
			test="${!empty param['nome'] && !empty param['idade'] && !empty param['endereco']}">
			<p>Confirme os dados:</p>
			<form id="formulario" method="POST"
				action='<c:url value="/exercicio4/confirmado.jsp" />'>
				<div>
					<label>Nome:</label> <span class="confirmar">${param['nome']}</span>
					<input type="hidden" name="nome" value="${param['nome']}" />
				</div>
				<div>
					<label>Idade:</label> <span class="confirmar">${param['idade']}</span>
					<input type="hidden" name="idade" value="${param['idade']}" />
				</div>
				<div>
					<label>Endereço:</label> <span class="confirmar">${param['endereco']}</span>
					<input type="hidden" name="endereco" value="${param['endereco']}" />
				</div>
				<input type="submit" value="Confirmar" />
			</form>
		</c:when>
		<c:otherwise>
			<p>Preencha os campos:</p>
			<form id="formulario" method="POST"
				action='<c:url value="/exercicio4/index.jsp" />'>
				<div>
					<label>Nome</label> <input type="text" name="nome" />
				</div>
				<div>
					<label>Idade</label> <input type="text" name="idade" />
				</div>
				<div>
					<label>Endereço</label> <input type="text" name="endereco" />
				</div>
				<input type="submit" value="Enviar" />
			</form>
		</c:otherwise>
	</c:choose>
</body>
</html>